package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsOrderMapper;
import com.qf.pojo.DtsOrder;
import com.qf.service.DtsOrderService;
import com.qf.mapper.StatMapper;
import com.qf.vo.CategorySellAmts;
import com.qf.vo.DayStatis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZhangYuJie
 * projectName:shop_manage
 * time:2022/5/17 8:22
 * description:
 */
@Service
public class DtsOrderServiceImpl implements DtsOrderService {

    @Autowired
    DtsOrderMapper dtsOrderMapper;

    @Autowired
    StatMapper dtsStatMapper;

    @Override
    public List<DayStatis> recentCount(int statisDaysRang) {
        return dtsStatMapper.statisIncreaseOrderCnt(statisDaysRang);
    }

    @Override
    public List<CategorySellAmts> categorySell() {
        return dtsStatMapper.categorySellStatis();
    }

    @Override
    public int count() {
        QueryWrapper<DtsOrder> wapper = new QueryWrapper<>();
        wapper.eq("deleted", false);
        Integer count = dtsOrderMapper.selectCount(wapper);
        return count;
    }
}
